// JavaScript Document

$("#grid_div a").each(function(index, element) {
  var  ids=index_pic_ids.split(",");
  $(element).attr("mid",ids[index+1]);
});